package com.xiaomai.Action;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.util.ValueStack;
import com.xiaomai.entity.AddressEntity;
import com.xiaomai.entity.Cart;
import com.xiaomai.entity.UserEntity;
import com.xiaomai.server.AddressService;
import com.xiaomai.server.AddressServiceImpl;

public class AddressAction extends ActionSupport{
	private AddressEntity a;
	//取值栈
	private static ValueStack valueStack=ActionContext.getContext().getValueStack();
	//拿到user对象
	private UserEntity user=(UserEntity) valueStack.findValue("#session.login");
	//拿到购物车项对象
	private Cart cart=(Cart) valueStack.findValue("#session.cart");
	
	
	@Override
	public String toString() {
		return "AddressAction [a=" + a + "]";
	}

	public AddressEntity getA() {
		return a;
	}

	public void setA(AddressEntity a) {
		this.a = a;
	}

	public String Addres(){	
		AddressService addr=new AddressServiceImpl();
		
		addr.address(user, a, cart);
		return "address_success";
		
	}
}
